/*
 * Author: Jeff Liu(jebberwocky@gmail.com)
 * Date: Sep 7, 2010 9:27:46 PM
 * 
 * License: MIT
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
 * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
package org.gglgeo.ggl;

// TODO: Auto-generated Javadoc
/**
 * The Class GeoLatLng.
 */
public class GeoLatLng implements Cloneable {
	
	/** The not defined constant */
	public static GeoLatLng NOT_DEFINE_LAT_LNG = new GeoLatLng(-999.9,-999.9);
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((lat == null) ? 0 : lat.hashCode());
		result = prime * result + ((lng == null) ? 0 : lng.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		GeoLatLng other = (GeoLatLng) obj;
		if (lat == null) {
			if (other.lat != null)
				return false;
		} else if (!lat.equals(other.lat))
			return false;
		if (lng == null) {
			if (other.lng != null)
				return false;
		} else if (!lng.equals(other.lng))
			return false;
		return true;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#clone()
	 */
	@Override
	protected Object clone() throws CloneNotSupportedException {
		// TODO Auto-generated method stub
		return super.clone();
	}
	
	/* return string lat+","+lng e.g. "34.12,123.4"
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return lat+","+lng;
	}
	
	/**
	 * Instantiates a new geo lat lng.
	 *
	 * @param lat the lat
	 * @param lng the lng
	 */
	public GeoLatLng(Double lat, Double lng) {
		super();
		this.lat = lat;
		this.lng = lng;
	}
	
	/**
	 * Gets the lat.
	 *
	 * @return the lat
	 */
	public Double getLat() {
		return lat;
	}
	
	/**
	 * Sets the lat.
	 *
	 * @param lat the new lat
	 */
	public void setLat(Double lat) {
		this.lat = lat;
	}
	
	/**
	 * Gets the lng.
	 *
	 * @return the lng
	 */
	public Double getLng() {
		return lng;
	}
	
	/**
	 * Sets the lng.
	 *
	 * @param lng the new lng
	 */
	public void setLng(Double lng) {
		this.lng = lng;
	}
	
	/** The lat. */
	private Double lat;
	
	/** The lng. */
	private Double lng;
}
